<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>管理系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {:widget_st('layui','css')}
  {:widget_st('admin','css')}
</head>
{:do_action('admin_head')}
<body>

  <div class="layui-fluid">
    <div class="layui-card">
      <div class="layui-card-body">
          <div class="layui-row layui-col-space15">
              <div class="layui-col-md8">
                  <div class="layui-card">
                    <div class="layui-card-header">基本参数</div>
                    <div class="layui-card-body">
                      <form class="layui-form info_tj" method="post">
                        <div class="layui-row layui-col-space10 layui-form-item">
                          <div class="layui-col-lg6">
                            <label class="layui-form-label">文件名:</label>
                            <div class="layui-input-block">
                              <input type="text" name="filename_dir" placeholder="" autocomplete="off" class="layui-input filename_dir" value="<?php echo date('YmdHis',time()); ?>">
                            </div>
                            <br>
                            <label class="layui-form-label">保存目录:</label>
                            <div class="layui-input-block">
                              <select name="dir_type" class="dir_type">
                                <option value="theme">当前模板目录(./theme/{:ZFC('zf_tpl_suffix')}/db)</option>
                                <option value="backup">系统备份目录(./backup/db)</option>
                              </select>
                            </div>
                          </div>
                          <div class="layui-col-lg6">
                          </div>
                        </div>

      
                        <div class="layui-form-item">
                          <div class="layui-input-block">
                            <span class="layui-btn  tijiao" lay-submit="" lay-filter="component-form-element">提交</span>
                          </div>
                        </div>
                      </form>
                    </div>
                  </div>            
              </div>
          </div>

      </div>
    </div>
  </div>
  {:widget_st('jq','js')}
  {:widget_st('layui','js')}
  {:widget_st('common','js')} 

  <script>
  layui.use(['element'], function(){
    var $ = layui.$
    ,form = layui.form
    ,element = layui.element;

    $(".tijiao").on("click",function(){
      var index = layer.load(1);
      var filename_dir = $(".filename_dir").val();  
      var dir_type = $(".dir_type").val();
      var method = $("input[name='method']:checked").val();
      var charset = $("input[name='charset']:checked").val();
      var hex = $("input[name='hex']:checked").val();
      var zip = $("input[name='zip']:checked").val();
      $.ajax({
          type:'post',
          url:"{:url('mysql/backup')}",
          data:{filename_dir:filename_dir,dir_type:dir_type,method:method,charset:charset,hex:hex,zip:zip},
          dataType:'json',
          success:function(res){
            layer.close(index);
            if(res.result==1){
              layer.msg(res.msg, {icon: 1});
              return
            }else{
              layer.msg(res.msg, {icon: 2});
              return
            }
          }
      })
    })
  });
  </script>
</body>
</html>
{:do_action('admin_js')}
